---
layout: example
category: example
title: Add live realtime data
description: Use realtime GeoJSON data streams to move a symbol on your map
tags:
  - sources
---
<div id='map'></div>

<script>
var map = new mapboxgl.Map({
    container: 'map',
    style: 'mapbox://styles/mapbox/streets-v9',
    zoom: 0
});

var url = 'https://wanderdrone.appspot.com/';
map.on('load', function () {
    window.setInterval(function() {
        map.getSource('drone').setData(url);
    }, 2000);

    map.addSource('drone', { type: 'geojson', data: url });
    map.addLayer({
        "id": "drone",
        "type": "symbol",
        "source": "drone",
        "layout": {
            "icon-image": "rocket-15"
        }
    });
});
</script>
